//关联订单表格
import React from 'react'
import { Typography, Space } from 'antd';
import TheTable from "@/components/TheTable"
import TheButton from '@/components/TheButton';
const { Text } = Typography;

export default class linkedOrder extends React.PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      info: props.info, //数据信息
      columns: [
        {
          title: '订单编号',
          dataIndex: "orderId",
          key: "orderId",
        },
        {
          title: '类型',
          render: () => {
            return '普通订单'
          }
        },
        {
          title: '操作',
          render: (_, record) => {
            return <TheButton haspermi={['call:afterSaleOrder:aboutOrder']} onClick={() => { this.props.history.push('/call/order/orderList/details/' + record.orderId) }}>查看订单</TheButton>
          }
        }
      ],
      dataSource: [],
    }
  }
  async componentDidMount() {
    await this.getData()
  }
  // 数据处理
  getData = async () => {
    let { info } = this.props
    this.setState({ dataSource: [] })
    if (info) {
      this.setState({
        dataSource: info.relationOrderList
      })
    }
  }
  render() {
    const { columns, dataSource, } = this.state
    return (
      <div >
        <div style={{ fontSize: 14, margin: ' 10px  0', fontWeight: 600 }}>关联订单</div>
        <TheTable dataSource={dataSource} columns={columns} />
      </div>
    )
  }
}